# -*- coding: utf-8 -*-
__doc__ = '我的已审页面'

from selenium.webdriver.common.by import By

from PageClass.basePage import BasePage
from Util import logger, ZTCCLOUDError


class EcsMyApprovedPage(BasePage):
    # 单据编号
    _boeNo = (By.ID, 'undefined_boeNo')

    def getBoeNo(self):
        return self._boeNo

    def input_boeNo(self, text):
        self.send_text(text, *self._boeNo)
        logger.info(f"输入查询的单据编号为：{text}")

    # 查询
    def click_boeNoSelectButton(self):
        self.click_button('查询')
        logger.info("点击查询按钮")

    # 查询结果(单号)
    _boeNoSelectResult = (By.XPATH, '//*[@id="app"]//table/tbody/tr/td[2]')

    def selectResultIsOrNot(self, boeNum):
        if self.get_elementText(*self._boeNoSelectResult) == boeNum:
            logger.info("Success ， 查询出对应结果")
            return True
        else:
            logger.info("Fail ， 没有查询出对应结果")
            return False

    # 点击撤回按钮
    def click_withdrawButton(self):
        self.click_button('撤回')
        logger.info('点击撤回按钮')

    # 点击确定
    def click_boeBusinessTipConfirm(self):
        self.click_button('确定')
        logger.info('点击确定按钮')
